﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;

//⽗类定义了static静态成员，则整个继承体系⾥⾯只有⼀个这样的成员。⽆论派⽣出多少个⼦类，都只
//有⼀个static成员实例。


class Base {
public:
	static int num;
};
int Base::num = 1;
class Derived:public Base
{
public:

};
int main() {
	Base b;
	Derived d;
	cout << &b.num << endl;
	cout << &d.num << endl;
	cout << b.num << endl;
	cout << d.num << endl;
	d.num++;
	cout << b.num << endl;
	cout << d.num << endl;
	return 0;
}